package com.hc.dao;

import com.hc.pojo.Dept;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * 部分的dao层 模拟数据库中的数据
 * @author hs
 * @date 2021/05/03
 */
@Repository
public class DeptDao {
    private static Map<Integer, Dept> map = null;

    static {
        map = new HashMap<Integer, Dept>(7);
        map.put(101,new Dept(101,"教学部"));
        map.put(102,new Dept(102,"市场部"));
        map.put(103,new Dept(103,"教研部"));
        map.put(104,new Dept(104,"运营部"));
        map.put(105,new Dept(105,"后勤部"));
    }

    public Collection<Dept> findDeptAll(){
        return map.values();
    }

    public Dept findById(Integer id){
        return map.get(id);
    }
}
